package koala.kuangjiademo.util;

import android.content.Context;

import java.io.File;
import java.util.List;

import koala.kuangjiademo.net.IResponseStatus;
import koala.kuangjiademo.net.OnResponseListener;
import koala.kuangjiademo.net.RequestManager;


public abstract class MyImageUploader extends ImageUploader {
    private Context context;

    public MyImageUploader(Context context) {
        this.context = context;
    }

    @Override
    public void onPrepareUploadFile() {
        Helper.showProgressDialog(context);
    }

    @Override
    public void upload(final ImageCaptureUtil util, final int viewId, File file) {
        RequestManager.uploadImage(file, new OnResponseListener<String>(context, true, false) {
            @Override
            public void onResponse(IResponseStatus status, String tail) {
                onFinishOne(util, viewId, tail);
            }
        });
    }

    @Override
    public abstract void onFinishAll(List<ImageHolder> urls);
}
